﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Console.Threads.Threads;

namespace Demos.Threads
{

    /// <summary>
    /// 多线程带返回
    /// </summary>
    public class ExecResultThread
    {

        public static void Start()
        {
            //线程执行类
            ThreadHelper help = new ThreadHelper();
            //创建线程执行对象
            Thread thread = new Thread(help.Test1);
            //运行线程
            thread.Start("参数0000001");
            //等待结果, 确保子线程执行完成再执行主线程
            thread.Join();
            //获取返回值
            var result = help.Result;
            System.Console.WriteLine($"执行线程成功，返回：help.Result{help.Result},help.Message:{help.Message}");
        }
    }
}
